﻿using System;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer.stmt.redshift
{
	// Token: 0x02000117 RID: 279
	public class TRedshiftPrepare : TCustomSqlStatement
	{
		// Token: 0x0600090E RID: 2318 RVA: 0x00302DE1 File Offset: 0x00300FE1
		public TRedshiftPrepare(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstredshiftPrepare;
		}

		// Token: 0x0600090F RID: 2319 RVA: 0x00302DF8 File Offset: 0x00300FF8
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			base.doParseStatement(psql);
			TDummy tdummy = (TDummy)this.rootNode;
			this.planName = (TObjectName)tdummy.node1;
			if (tdummy.node3 != null)
			{
				this.datatypeList = (TTypeNameList)tdummy.node3;
			}
			switch (tdummy.node2.NodeType)
			{
			case 100:
				this.statement = new TSelectSqlStatement(this.dbvendor);
				break;
			case 101:
				this.statement = new TDeleteSqlStatement(this.dbvendor);
				break;
			case 102:
				this.statement = new TUpdateSqlStatement(this.dbvendor);
				break;
			case 103:
				this.statement = new TInsertSqlStatement(this.dbvendor);
				break;
			}
			this.statement.rootNode = tdummy.node2;
			this.statement.doParseStatement(this);
			return 0;
		}

		// Token: 0x17000197 RID: 407
		// (get) Token: 0x06000910 RID: 2320 RVA: 0x00302EDD File Offset: 0x003010DD
		// (set) Token: 0x06000911 RID: 2321 RVA: 0x00302EE5 File Offset: 0x003010E5
		public virtual TTypeNameList DatatypeList
		{
			get
			{
				return this.datatypeList;
			}
			set
			{
				this.datatypeList = value;
			}
		}

		// Token: 0x17000198 RID: 408
		// (get) Token: 0x06000912 RID: 2322 RVA: 0x00302EEE File Offset: 0x003010EE
		// (set) Token: 0x06000913 RID: 2323 RVA: 0x00302EF6 File Offset: 0x003010F6
		public virtual TObjectName PlanName
		{
			get
			{
				return this.planName;
			}
			set
			{
				this.planName = value;
			}
		}

		// Token: 0x17000199 RID: 409
		// (get) Token: 0x06000914 RID: 2324 RVA: 0x00302EFF File Offset: 0x003010FF
		// (set) Token: 0x06000915 RID: 2325 RVA: 0x00302F07 File Offset: 0x00301107
		public virtual TCustomSqlStatement Statement
		{
			get
			{
				return this.statement;
			}
			set
			{
				this.statement = value;
			}
		}

		// Token: 0x06000916 RID: 2326 RVA: 0x00302F10 File Offset: 0x00301110
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06000917 RID: 2327 RVA: 0x00302F20 File Offset: 0x00301120
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			this.statement.accept(v);
			v.postVisit(this);
		}

		// Token: 0x04001237 RID: 4663
		private TTypeNameList datatypeList;

		// Token: 0x04001238 RID: 4664
		private TObjectName planName;

		// Token: 0x04001239 RID: 4665
		private TCustomSqlStatement statement;
	}
}
